import {Component, OnInit, Input, OnDestroy} from '@angular/core';
import {Router, NavigationEnd, ActivatedRoute} from '@angular/router';
import {HomeService} from '../home.service';

@Component({
    selector: 'kylin-side-menu',
    templateUrl: './side-menu.component.html',
    styleUrls: ['./side-menu.component.less']
})
export class SideMenuComponent implements OnInit, OnDestroy {

    @Input() width = '200px';
    @Input() sidebarMenuData = [];
    isCollapsed = false;

    constructor(private router: Router,
                private route: ActivatedRoute,
                private homeService: HomeService) {
    }

    ngOnInit() {
        this.homeService.nzCollapsedObservable.subscribe((value: boolean) => {
            this.isCollapsed = value;
        });

        this.router.events.subscribe(event => {
            if (event instanceof NavigationEnd) {

            }
        });
    }

    ngOnDestroy() {

    }
}
